﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;
using Peak.Core;

namespace Peak.Data.NHibernateMaps
{
  public class CalendarMap : IAutoMappingOverride<Calendar>
  {
    public void Override(AutoMapping<Calendar> mapping)
    {
      mapping.Id(x => x.Id, "id").UnsavedValue(0).GeneratedBy.Identity();
      mapping.Map(x => x.Monday);
      mapping.Map(x => x.Tuesday);
      mapping.Map(x => x.Wednesday);
      mapping.Map(x => x.Thursday);
      mapping.Map(x => x.Friday);
      mapping.Map(x => x.Saturday);
      mapping.Map(x => x.Sunday);
      mapping.HasMany(x => x.Holidays).Cascade.All();
    }
  }
}